package com.wuercloud.controller;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.wuercloud.entity.ConfigEntity;
import com.wuercloud.service.ConfigService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

@RestController
@Api(value = "/ismp/mqconfig", description = "返回接口数据")
@RequestMapping("/ismp/mqconfig")
public class ApiController {
	@Autowired
	private ConfigService configService;

	@ApiOperation(value = "接口调用", notes = "返回列表数据", httpMethod = "GET", produces = MediaType.APPLICATION_JSON_VALUE)
	@RequestMapping(value = "/alls", method = RequestMethod.GET)
	public Map<String, Object> select() {
		// 查询列表数据
		List<ConfigEntity> lists = configService.queryList(new HashMap<String, Object>());
		Map<String, Object> map = new HashMap<>();

		lists.stream().forEach(configEntity -> map.put(configEntity.getMapKey(), configEntity.getBindingKey()));
		return map;
	}

}
